    using SmartSoft.DAL;
    using System.Web.Services;
    using System;
    using System.Data;
    using System.Data.SqlClient;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WSCTBHDataAccess : System.Web.Services.WebService
{
    private CTBHDataAccess objDataAccess = new CTBHDataAccess();
    public WSCTBHDataAccess()
    {
    }


    [WebMethod]
    public int CheckInvoiceLock(string ps_Subsidiary, string ps_UserName, object ps_InvoiceOrder)
    {
        object[] arr = Validator.Validate(ps_InvoiceOrder);
        return objDataAccess.CheckInvoiceLock(ps_Subsidiary, ps_UserName, arr[0]);
    }

    [WebMethod]
    public int CheckInvoicePost(string ps_Subsidiary, string ps_UserName, object ps_InvoiceOrder, object pi_Posted)
    {
        object[] arr = Validator.Validate(ps_InvoiceOrder, pi_Posted);
        return objDataAccess.CheckInvoicePost(ps_Subsidiary, ps_UserName, arr[0], arr[1]);
    }

    [WebMethod]
    public int CheckInvoiceStatus(string ps_Subsidiary, string ps_UserName, object ps_InvoiceOrder)
    {
        object[] arr = Validator.Validate(ps_InvoiceOrder);
        return objDataAccess.CheckInvoiceStatus(ps_Subsidiary, ps_UserName, arr[0]);
    }

    [WebMethod]
    public object Cong_So_Ct(string ps_Subsidiary, string ps_InvoiceCode, object pd_Ngay_Ct, object ps_So_Ct)
    {
        object[] arr = Validator.Validate(pd_Ngay_Ct, ps_So_Ct);
        return objDataAccess.Cong_So_Ct(ps_Subsidiary, ps_InvoiceCode, arr[0], arr[1]);
    }

    [WebMethod]
    public bool Delete(string ps_UserName, object po_KeyCode)
    {
        object[] arr = Validator.Validate(po_KeyCode);
        return objDataAccess.Delete(ps_UserName, arr[0]);
    }


    [WebMethod]
    public DataSet GetDetailDataSet(string ps_InvoiceOrder)
    {

        return objDataAccess.GetDetailDataSet(ps_InvoiceOrder);
    }

    [WebMethod]
    public DataTable GetDetailSales(object ps_MasterKey, object ps_ParentKey)
    {
        object[] arr = Validator.Validate(ps_MasterKey, ps_ParentKey);
        return objDataAccess.GetDetailSales(arr[0], arr[1]);
    }

    [WebMethod]
    public DataTable GetMasterDataRow(string ps_InvoiceOrder)
    {

        return SSDataAccess.ConvertRowToTable(objDataAccess.GetMasterDataRow(ps_InvoiceOrder));
    }

    [WebMethod]
    public DataTable GetMasterSales(bool pb_FirstTime, string ps_Subsidiary, object ps_ParentKey, object pd_Ngay_Ct, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object ps_Ma_Dt)
    {
        object[] arr = Validator.Validate(ps_ParentKey, pd_Ngay_Ct, pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Dt);
        return objDataAccess.GetMasterSales(pb_FirstTime, ps_Subsidiary, arr[0], arr[1], arr[2], arr[3], arr[4]);
    }

    [WebMethod]
    public DataTable GetMasterTable(string ps_Subsidiary, int pi_DaysFilter, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object ps_So_Ct1, object ps_So_Ct2, object ps_Ma_Ct, object ps_Ma_Tte, object ps_Tk, object ps_Tk_Du, object ps_Ma_Dt, object pi_Tien1, object pi_Tien2, object ps_Ma_Km, object ps_Ma_Bp, object ps_Ma_Hd, object ps_Ma_Nx, object ps_Ma_Kho, object ps_Ma_Vt, object ps_Dien_Giai, object ps_Ma_Loai1, object ps_Ma_Loai2, object ps_Ma_Loai3, int ii_FilterByUser, string ps_UserName, object ps_Notes, int pi_Posted, int pi_Locked)
    {
        object[] arr = Validator.Validate(pd_Ngay_Ct1, pd_Ngay_Ct2, ps_So_Ct1, ps_So_Ct2, ps_Ma_Ct, ps_Ma_Tte, ps_Tk, ps_Tk_Du, ps_Ma_Dt, pi_Tien1, pi_Tien2, ps_Ma_Km, ps_Ma_Bp, ps_Ma_Hd, ps_Ma_Nx, ps_Ma_Kho, ps_Ma_Vt, ps_Dien_Giai, ps_Ma_Loai1, ps_Ma_Loai2, ps_Ma_Loai3, ps_Notes);
        return objDataAccess.GetMasterTable(ps_Subsidiary, pi_DaysFilter, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8], arr[9], arr[10], arr[11], arr[12], arr[13], arr[14], arr[15], arr[16], arr[17], arr[18], arr[19], arr[20], ii_FilterByUser, ps_UserName, arr[21], pi_Posted, pi_Locked);
    }

    [WebMethod]
    public void Lock(string ps_UserName, object ps_InvoiceOrder, bool pb_Locked)
    {
        object[] arr = Validator.Validate(ps_InvoiceOrder);
        objDataAccess.Lock(ps_UserName, arr[0], pb_Locked);
    }

    [WebMethod]
    public bool NumberExisted(string ps_Subsidiary, bool pb_CheckNewRow, string ps_InvoiceOrder, string ps_InvoiceCode, object pd_Ngay_Ct, object ps_So_Ct)
    {
        object[] arr = Validator.Validate(pd_Ngay_Ct, ps_So_Ct);
        return objDataAccess.NumberExisted(ps_Subsidiary, pb_CheckNewRow, ps_InvoiceOrder, ps_InvoiceCode, arr[0], arr[1]);
    }

    [WebMethod]
    public bool Post(string ps_UserName, object ps_InvoiceOrder, object pi_Posted)
    {
        object[] arr = Validator.Validate(ps_InvoiceOrder, pi_Posted);
        return objDataAccess.Post(ps_UserName, arr[0], arr[1]);
    }

    [WebMethod]
    public bool Save(bool pb_InvoiceHistory, bool pb_NewChecked, string ps_Subsidiary, string ps_UserName, DataTable po_MasterDataRow, DataTable po_DetailTable, ref bool pb_CheckOverFlow)
    {

        return objDataAccess.Save(pb_InvoiceHistory, pb_NewChecked, ps_Subsidiary, ps_UserName, po_MasterDataRow.Rows[0], po_DetailTable, ref pb_CheckOverFlow);
    }
}